Skip to content

fix(cold-store-reaper): validate JSON shape in load_state/load_credentials - #7552

Merged
dezren39 merged 1 commit into
mainfrom
fallback/6845-cold-store-shape
Nov 11, 2026
Merged

dezren39 merged 1 commit into
mainfrom
fallback/6845-cold-store-shape

Conversation

@developing-today

@developing-today developing-today Bot commented Nov 8, 2026 •

Copy link
Copy Markdown
Contributor

Closes #6845

What

load_credentials and load_state in pkgs/cold-store-reaper/cold_store.py parsed JSON syntax but not shape: valid-but-wrong-shape files raised raw AttributeError/TypeError/ValueError far from the cause, and a non-string folder id was silently used as a Drive folder id.

  • load_credentials: non-object top level now raises ColdStoreError naming credentials.json, the unexpected shape, and the existing repair guidance. Values present for client_id / client_secret / refresh_token must be strings; a non-string value raises the same named error instead of passing the truthiness check.
  • load_state: non-object top level raises ColdStoreError naming state.json and the shape. A present folders field must be an object mapping names to string folder ids; any other shape raises the named error instead of a downstream raw error or a silently mistyped id.
  • Shared _json_shape() helper names the parsed shape in both loaders' messages.

Tests

New TestWrongShapePrivateJson in pkgs/cold-store-reaper/tests/test_cold_store.py covers: non-object top level for both files, non-string credential value (all three known keys), non-object folders, non-string folder id, plus happy-path controls.

  • Targeted: TestWrongShapePrivateJson + TestAtomicPrivateJson — 10 tests, OK (laptop).
  • Full suite: python3 -m unittest discover -s pkgs/cold-store-reaper/tests — 152 tests, OK (skipped=1) on the laptop.

Filed by lane code-a in fleet queue fallback mode (queue backend down; claim on issue #6845).


Autofix with [code]smith
Open in [code]smith · Need help on this PR? Tag @codesmith-bot with what you need.

@developing-today
developing-today Bot requested review from a team and dezren39 as code owners November 8, 2026 07:23
@coderabbitai

coderabbitai Bot commented Nov 8, 2026

Copy link
Copy Markdown

Important

Review skipped

Bot user detected.

To trigger a single review, invoke the @coderabbitai review command.

Run configuration

  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: defaults
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 8bc87d66-cd5f-4777-913e-b9ab2f1f3e09

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • Trigger review
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

Share

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

1 participant